/* eslint-disable no-shadow */
const state = {
  active: 0, // 当前第几个页面，和第几个题目没关系，有的页面有多个题目(ps：修改的时候底下activePass一块修改，dom太多，一次全加载页面操作卡顿，v-if控制下性能)
  activePass: 0,
  ajaxRes: false,
  ajaxResMessage: {},
  ownSickList: [],
  familySickList: [],
  assessPatientId: '',
  isHaveDiabetes: false, // 是否有糖尿病，第23，25题有3个根据条尿病的必填校验
  userSex: '',
  assessForm: {
    physicalExaminationDate: '', // 体检日期
    height: '', // 身高，单位cm
    weight: '', // 体重，单位kg
    waistline: '', // 腰围，单位cm
    sleep: '', // 睡眠质量1一觉到天亮2早醒后难入睡3入睡困难4多梦、常醒
    FBG: '', // 空腹血糖
    PBG: '', // 餐后血糖
    HBALC: '', // 糖化血红蛋白
    Scr: '', // 血肌酐
    scrUnit: '', // 血肌酐单位 1=umol/L 2=mg/dl
    uricAcid: '', // 尿酸
    eGFR: '',
    TG: '', // 甘油三酯
    TCHO: '', // 总胆固醇
    LDL: '', // 低密度脂蛋白胆固醇
    Hcy: '', // 血浆同型半胱氨酸
    serumKalium: '', // 血钾
    MAU: '', // 尿微量白蛋白
    fundoscopy: '', // 眼底检查
    oralExamination: '', // 口腔检查
    footExamination: '', // 足部检查
    PNP: '',
    auscultation: '',
    isExercise: '', // 是否运动 1=无 2=规律运动 3=不规律运动
    appetite: '', // 口味轻重 1=轻 2=重 3=中
    drink: '', // 饮酒 1=不喝 2=偶尔少量和 3=常喝或每次量较大
    smok: '', // 吸烟 1从不 2吸烟（含常吸二手烟）3戒烟
    HDL: '', // 高密度脂蛋白胆固醇
    serumNa: '', // 血钠
    nutrition: '', // 饮食营养 1均衡（荤素搭配较好）2偏食（偏荤/偏素/纯素食）3应酬多食量大
    snore: '', // 打鼾 1打鼾2打鼾伴呼吸暂停3无
    AST: '', // AST
    dailyWork: '', // 日常工作或活动量1轻2中3重4超重
    heartRate: '', // 心率
    ALT: '',
    constipation: '', // 便秘1否2是
    BMI: '', // 体重／身高²
    SBP: '', // 高压
    DBP: '', // '低压
    hPylori: ''
  },
  scTime: '',
  assessMedicine: []
};

const mutations = {
  SET_SCTIME: (state, scTime) => {
    state.scTime = scTime;
  },
  SET_TEST: (state, test) => {
    state.test = test;
  },
  SET_ACTIVE: (state, active) => {
    state.active = active;
  },
  SET_ACTIVEPASS: (state, activePass) => {
    state.activePass = activePass;
  },
  SET_AJAXRES: (state, ajaxRes) => {
    state.ajaxRes = ajaxRes;
  },
  SET_AJAXRESMESSAGE: (state, ajaxResMessage) => {
    state.ajaxResMessage = ajaxResMessage;
  },
  SET_OWNSICKLIST: (state, ownSickList) => {
    state.ownSickList = ownSickList;
  },
  SET_FAMILYSICKLIST: (state, familySickList) => {
    state.familySickList = familySickList;
  },
  SET_ASSESSFORM: (state, assessForm) => {
    state.assessForm = assessForm;
  },
  SET_ASSESSPATIENTID: (state, assessPatientId) => {
    state.assessPatientId = assessPatientId;
    wx.setStorageSync('assessPatientId', assessPatientId);
  },
  SET_ISHAVEDISABETES: (state, isHaveDiabetes) => {
    state.isHaveDiabetes = isHaveDiabetes;
  },
  SET_USERSEX: (state, userSex) => {
    state.userSex = userSex;
  },
  SET_ASSESSMEDICINE: (state, medicines) => {
    state.assessMedicine = medicines;
  }
};

const actions = {
  // user login
};

export default {
  namespaced: true,
  state,
  mutations,
  actions
};
